import type { InitState } from './layouts';

/**
 * @see https://umijs.org/zh-CN/plugins/plugin-access
 * */
export default function access(initialState: InitState) {
  const { curUser, sysName } = initialState || {};
  return {
    main: sysName !== 'audit',
    audit: sysName === 'audit',
    isAdmin: curUser && curUser.rolename === '系统管理员',
    isArchivist:
      curUser && (curUser.rolename === '档案管理员' || curUser.rolename === '系统管理员'),
  };
}
